/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package swing;

import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JOptionPane;

/**
 *Window for our application
 * @author Iskandar Sarkawi
 */
public class Example3a_GUI extends JFrame{
   
    protected JTextField txtField1;
    protected JTextField txtField2;
    protected JTextField txtField3;
    protected JPasswordField passwordField;

    public Example3a_GUI(){
        super("Welcome to the Survey");
        setLayout(new FlowLayout());

        txtField1 = new JTextField(10);//set parameter to 10
        txtField1.setActionCommand("txtField1");
        add(txtField1);//add to window
        
        txtField2 = new JTextField("Enter text here");//set default text
        txtField2.setActionCommand("txtField2");
        add(txtField2);

        txtField3 = new JTextField("UnEditable", 20 );//set default text and the length
        txtField3.setActionCommand("txtField3");
        txtField3.setEditable(false);
        add(txtField3);

        passwordField = new JPasswordField("mypassword");
        passwordField.setActionCommand("passwordField");
        add(passwordField);

        //we need to add some brain to the four above item
        
        Example3b_Handler handler = new Example3b_Handler();
        txtField1.addActionListener(handler);
        txtField2.addActionListener(handler);
        txtField3.addActionListener(handler);
        passwordField.addActionListener(handler);

    }
}
